/**
 * 
 */
package com.ruyipu.forum.item;

import java.io.Serializable;

import org.json.JSONException;
import org.json.JSONObject;

import com.ruyipu.forum.interfaces.IItem;

/**
 * @author donald
 * 
 */
public class Category implements IItem, Serializable {
	
	public static final String TAG = Category.class.getSimpleName();
	public static final String NAME = Category.class.getName();
	
	private static final String CATEGORY_ID = "CategoryID";
	private static final String CATEGORY_NAME = "CategoryName";
	private static final String CATEGORY_DESC = "CategoryDescription";
	private static final String COUNT_COMMENTS = "CountComments";
	private static final String COUNT_DISCUSSIONS = "CountDiscussions";
	private static final String PARENT_CATEGORY_ID = "ParentCategoryID";
	
	private static final long serialVersionUID = -7955598569874273524L;
	
	private int iId;
	private String sName;
	private String sDescription;
	private int iCountDiscussions;
	private int iCountComments;
	private int iParentCategoryId;
	
	public Category() {
		
	}
	
	public void parse(JSONObject jsonObject) throws JSONException {
		iId = jsonObject.getInt(CATEGORY_ID);
		sName = jsonObject.getString(CATEGORY_NAME);
		sDescription = jsonObject.getString(CATEGORY_DESC);
		iCountComments = jsonObject.getInt(COUNT_COMMENTS);
		iCountDiscussions = jsonObject.getInt(COUNT_DISCUSSIONS);
		iParentCategoryId = jsonObject.getInt(PARENT_CATEGORY_ID);
	}
	
	
	
//	private int TreeLeft;
//	private int TreeRight;
//	private int Depth;
//	private Date DateMarkedRead;
//	private Short AllowDiscussions;
//	private Short Archived;
//	private String UrlCode;
//	private int Sort;
//	private int PermissionCategoryID;
//	private int InsertUserID;
//	private int UpdateUserID;
//	private Date DateInserted;
//	private Date DateUpdated;
//	private int LastCommentID;
//	private int LastDiscussionID;

	public int getId() {
		return iId;
	}

	public String getName() {
		return sName;
	}

	public String getDesc() {
		return sDescription;
	}

	public int getCommentCount() {
		return iCountComments;
	}

	public int getDiscussionCount() {
		return iCountDiscussions;
	}

	public int getParentCategoryId() {
		return iParentCategoryId;
	}
}
